package com.heima.comment.controller;

import com.heima.comment.service.CommentService;
import com.heima.model.comment.dtos.CommentDTO;
import com.heima.model.comment.dtos.CommentLikeDTO;
import com.heima.model.comment.dtos.CommentSaveDTO;
import com.heima.model.common.dtos.ResponseResult;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author XHui
 * @Since 2024/3/4 16:06
 * @Version 1.0
 */
@Api(value = "app端用户管理api", tags = "app端用户管理api")
@RestController
@RequestMapping("/api/v1/comment")
public class ApCommentController {

    @Resource
    private CommentService commentService;

    @PostMapping("/save")
    public ResponseResult saveComment(@RequestBody @Validated CommentSaveDTO dto)  {
             return commentService.saveComment(dto);
    }

    @PostMapping("/like")
    public ResponseResult likeOperation(@RequestBody @Validated CommentLikeDTO dto) {
        return commentService.likeOperation(dto);
    }

    @PostMapping("/load")
    public ResponseResult loadComment(@RequestBody @Validated CommentDTO dto)  {
        return commentService.loadComment(dto);
    }
}
